<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,viewport-fit=cover,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <title>我的会诊</title>
    <script src="js/rem.js"></script>
    <link rel="stylesheet" href="css/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.min.css">
    <link rel="stylesheet" href="css/public.css">
    <link rel="stylesheet" href="css/user.css">
    <script>(function() {var _53code = document.createElement("script");_53code.src = "https://tb.53kf.com/code/code/96d8f960b261e49515450f8953b044bc5/1";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(_53code, s);})();</script>
</head>
<body>
    <!-- 医生列表 -->
    <div class="pub-container user-consultation bgwhite">
        <div class="top-notice">咨询过的会诊在这里查看</div>
        <div class="main">
            <ul class="tabs space-border" id="ctab">
                <li class="active">我的会诊</li>
                <li>待会诊</li>
                <li>会诊结果</li>
            </ul>
            <ul class="c-list" id="clist">
                <li class="active" id="list1">
                </li>
                <li id="list2">
                </li>
                <li id="list3">
                </li>
            </ul>
        </div>
        <!--跳转小程序弹窗 -->
        <div class="weapp-popup">
            <div class="cont plr15">
                <wx-open-launch-weapp id="launch-btn" username="gh_3baf85f7018e" path="/pages/index/index" class="weapp-btn" >
                    <template> 
                        <style>
                            .btn {
                                text-align: center;
                                outline: none;
                                border: none;
                                background-color: transparent;
                                margin: 0;
                                width: 100vw;
                                height: 40px;
                                line-height: 40px;
                                vertical-align: middle;
                            }
                            .btn:focus{outline: none;}
                        </style>
                        <button class="btn">跳转小程序</button>
                    </template>
                </wx-open-launch-weapp>
            </div>
        </div>
    </div>
    <script src="js/jweixin-1.6.0.js"></script>
    <script src="js/jquery-3.6.0.min.js"></script>
    <script src="js/jquery-weui.min.js"></script>
    <script src="js/md5.js"></script>
    <script src="js/public.js"></script>
    <script>
        xcxConfig();
        var initXcx = false;
        $('#list3').on('click', '.consultation-info', function(e){
            location.href = "user-consul-detail.html?type=2&specialistId=" + $(e.currentTarget).attr('data-specialistId');
        })
        // tabs切换
        $('#ctab li').click(function(){
            var $this= $(this);
            $this.addClass('active').siblings().removeClass('active');
            $('#clist > li').removeClass('active').eq($this.index()).addClass('active');
            
            [getList1, getList2,getList3][$this.index()]();
        })
        getList1();
        // getList2();
        // getList3();

        // 获取医生用户列表 - 我的会诊
        function getList1(){
            http('/consulation/queryBasicByDoctor', {
                hasToken: true,
                success: function(res){
                    if(res.code === '01'){
                        var data = res.data, html = '';
                        data.forEach(function(item, index){
                            doctor = item.doctors ? item.doctors[0] : [], 
                            html += '<div class="consultation-info space-border plr15">' + 
                                '<div class="user-box box1">' + 
                                    '<p class="consultation-time">申请时间<span>' + format(item.consultTime) + '</span></p>' + 
                                    '<a class="custom-btn" href="' + customUrl + '">咨询客服</a>' + 
                                '</div>' + 
                                '<div class="user-box box5">' + 
                                    '<h4 class="user-pub-tit">基本信息</h4>' + 
                                    '<div class="box5-wrapper">' + 
                                        '<p class="line1"><span>' + item.patientName + '</span><span>' + SEXDINC[item.patientSex] + '</span><span>' + item.patientAge + '岁</span><span>' + item.patientNation + '</span><span>' + item.patientHight + 'cm</span><span>' + item.patientWeight + 'kg</span></p>' + 
                                        '<p class="line"><span class="pr20">患者电话</span><span>' + phoneDesensitization(item.patientPhone) +'</span></p>' + 
                                        '<p class="line"><span class="pr20">患者身份证号</span><span>' + cardDesensitization(item.patientNumber) +'</span></p>' + 
                                        '<p><span class="pr20">入院日期</span><span>' + format(item.enterHospital) +'</span></p>' + 
                                    '</div>' + 
                                '</div>' + 
                                '<div class="user-box box2">' + 
                                    '申请科室:<span>' + doctor.departmentCode + '</span>' + 
                                    '申请医生:<span>' + doctor.userName + '</span>' + 
                                '</div>' + 
                                '<div class="user-box box3">' + 
                                    '<p class="title">会诊目的</p>' + 
                                    '<p class="purpose">' + item.treamentMessage +'</p>' + 
                                '</div>' + 
                                '<div class="user-box box4">' + 
                                    '<div class="btn-wrapper">' + 
                                        '<a class="pub-bth" href="user-consul-detail.html?type=1&specialistId=' + item.specialistId + '">查看病例</a>' + 
                                    '</div>' + 
                                '</div>' + 
                            '</div>';
                        })
                        html += getNoDataHtml();
                        $('#list1').html(html);
                    }
                }
            });
        }
        // 获取医生用户列表 - 待会诊
        function getList2(){
            http('/consulation/queryMessageFromDoctor', {
                hasToken: true,
                success: function(res){
                    if(res.code === '01'){
                        var data = res.data, html = '';
                        data.forEach(function(item, index){
                            var type = item.type; //就诊方式
                            html += '<div class="consultation-info space-border pb0">' + 
                                '<div class="user-box box1 mlr15">' + 
                                    '<p class="consultation-time"><b>申请时间</b><span>' + format(item.consultTime) + '</span></p>' + 
                                    '<a class="custom-btn" href="' + customUrl + '">咨询客服</a>' + 
                                '</div>' + 
                                '<div class="user-box box3">' + 
                                    '<ul class="see-list plr15 pb15">' + 
                                        '<li>' + 
                                            '<p class="last-text-justify">会诊时间</p>' + 
                                            '<p class="txt2">' + format(item.consulationTime) + '</p>' + 
                                        '</li>' + 
                                        '<li>' + 
                                            '<p class="last-text-justify">会诊专家</p>' + 
                                            '<p class="txt2">' + item.consulationSpecialist + '</p>' + 
                                        '</li>' + 
                                        '<li>' + 
                                            '<p class="last-text-justify">会诊方式</p>' + 
                                            '<p class="txt2">' + CONSUTATIONTYPE[type] + '</p>' + 
                                        '</li>';
                                        if(type == 0){
                                            html += '<li>' + 
                                                '<p class="last-text-justify">会诊地址</p>' + 
                                                '<p class="txt2">北京市海淀区大钟寺四道口街道华杰大厦c座</p>' + 
                                            '</li>';
                                        }
                                    html += '</ul>'
                                    if(type == 1){
                                        html += '<div class="status-box plr15">' + 
                                            '<p class="status"></p>' + 
                                            '<div class="pay-btn toWeapp" data-address="' + item.consulationAddress + '">点击会诊</div>' + 
                                        '</div>';
                                    }
                                    
                            html += '</div>' + 
                            '</div>';
                        })
                        html += getNoDataHtml();
                        $('#list2').html(html);
                        $('#list2 .toWeapp').each(function(index,item){
                            $(item).html('开始会诊' + getWeappHtml($(item).attr('data-address')));
                        });
                        // xcxConfig();
                    }
                }
            });
        }
        // 获取医生用户列表 - 会诊结果
        function getList3(){
            http('/consulation/queryResultByDoctor', {
                hasToken: true,
                success: function(res){
                    if(res.code === '01'){
                        var data = res.data, html = '';
                        data.forEach(function(item, index){
                            var type = item.consulationType; //就诊方式
                            html += '<div class="consultation-info space-border" data-specialistId="' + item.specialistId + '">' + 
                                '<div class="user-box box1 plr15">' + 
                                    '<h4 class="user-pub-tit">会诊信息</h4>' + 
                                    '<a class="custom-btn" href="' + customUrl + '">咨询客服</a>' + 
                                '</div>' + 
                                '<div class="user-box box3 plr15">' + 
                                    '<ul class="see-list">' + 
                                        '<li>' + 
                                            '<p class="last-text-justify">会诊时间</p>' + 
                                            '<p class="txt2">' + item.consulationTime + '</p>' + 
                                        '</li>' + 
                                        '<li>' + 
                                            '<p class="last-text-justify">会诊专家</p>' + 
                                            '<p class="txt2">' + item.consulationSpecialist + '</p>' + 
                                        '</li>' + 
                                        '<li>' + 
                                            '<p class="last-text-justify">会诊方式</p>' + 
                                            '<p class="txt2">' + CONSUTATIONTYPE[type] + '</p>' + 
                                        '</li>' + 
                                        '<li>' + 
                                            '<p class="last-text-justify">会诊科室</p>' + 
                                            '<p class="txt2">' + item.consulationDepartment + '</p>' + 
                                        '</li>' + 
                                        '<li>' + 
                                            '<p class="last-text-justify">会诊地址</p>' + 
                                            '<p class="txt2">' + item.consulationAddress + '</p>' + 
                                        '</li>' + 
                                    '</ul>' + 
                                    '<p class="title">会诊意见</p>' + 
                                    '<p class="purpose">' + item.adviceMessage + '</p>' + 
                                '</div>' + 
                            '</div>';
                        })
                        html += getNoDataHtml();
                        $('#list3').html(html);
                    }
                }
            });
        }
    </script>
</body>
</html>